<div class="fm-content">
  <div class="title">
    <i nz-icon [type]="'desktop'"></i> &nbsp;&nbsp;栅格数据
  </div>
  <div class="work">
    <div class="top">
      <input nz-input placeholder="名称" class="fm-input first-input" [(ngModel)]="fs.queryObject['name:like']" />
      <input nz-input placeholder="类型" class="fm-input" [(ngModel)]="fs.queryObject['type:like']" />

      <nz-button-group class="fm-search-input">
        <button nz-button nzType="primary" (click)="fs.loadData(true)">查询</button>
        <button nz-button (click)="fs.resetQueryObject() && fs.loadData(true)">重置</button>
      </nz-button-group>
      <div class="tool-right">
        <nz-button-group>

          <button nz-button [nzType]="'primary'" (click)="fs.addRow()">上传数据</button>
          <button nz-button (click)="fs.editRow()">编辑</button>
          <button nz-popconfirm nzTitle="确认删除选择项?" (nzOnConfirm)="fs.delEntitys()" nzPlacement="bottomRight"
            nz-button>删除数据</button>
        </nz-button-group>
      </div>
    </div>

    <div class="work-content">
      <div class="table">
        <nz-table nzSize="middle" nzShowSizeChanger [nzPageSizeOptions]='[ 10, 15, 20, 30, 40, 50 ]'
          [nzFrontPagination]="false" [nzData]="fs.datas" [nzLoading]="fs.isLoading || fs.isDeleing"
          [nzTotal]="fs.rowsCount" [(nzPageIndex)]="fs.pageIndex" [(nzPageSize)]="fs.pageSize"
          (nzPageIndexChange)="fs.loadData()" (nzPageSizeChange)="fs.loadData(true)">
          <thead (nzSortChange)="fs.sort($event)" nzSingleSort>
            <tr>
              <th nzShowCheckbox [(nzChecked)]="fs.allChecked" [nzIndeterminate]="fs.indeterminate"
                (nzCheckedChange)="fs.checkAll($event)"></th>
              <th>文件名称</th>
              <th>文件类型</th>
              <th>源数据</th>
              <th>数据格式</th>
            </tr>
          </thead>
          <tbody>
            <tr *ngFor="let data of fs.datas">
              <td nzShowCheckbox [(nzChecked)]="data.checked" (nzCheckedChange)="fs.refreshCheckStatus()">
              </td>
              <td (click)="fs.editRow(data)" class="form-edit">{{data.name}}</td>
              <td>{{data.type}}</td>
              <td>{{data.source[0].key}}</td>
              <td>{{data.format}}</td>
            </tr>
          </tbody>
        </nz-table>
      </div>
    </div>

    <nz-modal nzWidth='830' nzTitle="选择文件" [nzMaskClosable]='false' [nzFooter]="null" [(nzVisible)]="fs.isEditVisible"
      (nzOnCancel)="fs.closeEdit()">
      <form nz-form [nzLayout]="'inline'">
        <nz-form-label nzRequired class="form-label">请选择要上传的数据类型</nz-form-label>
        <div>
          <nz-upload nzAction="{{ffs.getUploadUrl()}}" required [nzMultiple]="false" name="source"
            [(nzFileList)]="fs.er.source" (nzChange)="ffs.handleChange($event)"
            [nzShowUploadList]="{ showPreviewIcon: true, showRemoveIcon: fs.er.FIELD_ISNEW }">
            <button nz-button><i nz-icon type="upload" name="type"></i><span>点数据</span></button>
            <button nz-button><i nz-icon type="upload" name="type"></i><span>线数据</span></button>
            <button nz-button><i nz-icon type="upload" name="type"></i><span>面数据</span></button>
          </nz-upload>
        </div>

        <div>
          <nz-form-label nzRequired>文件说明，支持的数据格式有geojson、csv、tab、mif、shp</nz-form-label>
        </div>
        <div>
          <nz-form-label nzRequired>注意事项，tab、mif、shp文件格式请压缩成zip</nz-form-label>
        </div>


        <div class="form-button-align">
          <button nz-button nzType="default" (click)="fs.closeEdit()" class="form-button">取消</button>
          <button nz-button nzType="primary" (click)="fs.save()" [nzLoading]="fs.isSaveing">保存</button>
        </div>

      </form>
    </nz-modal>
  </div>
</div>